home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / dev / obero / oberon_lib.lha / oberon-a / source1.lha / source / Amiga / DiskFont.mod < prev    next >
Text File  |  1994-08-08  |  22KB  |  589 lines

  1. (***************************************************************************
  2.  
  3.      $RCSfile: DiskFont.mod $
  4.   Description: Interface to diskfont.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.2 $
  8.       $Author: fjc $
  9.         $Date: 1994/08/08 01:09:10 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A interface Copyright © 1994, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. ***************************************************************************)
  21.  
  22. MODULE DiskFont;
  23.  
  24. (*
  25. ** $C- CaseChk       $I- IndexChk  $L+ LongAdr   $N- NilChk
  26. ** $P- PortableCode  $R- RangeChk  $S- StackChk  $T- TypeChk
  27. ** $V- OvflChk       $Z- ZeroVars
  28. *)
  29.  
  30. IMPORT
  31.   E := Exec, D := Dos, U := Utility, G := Graphics, SYS := SYSTEM;
  32.  
  33.  
  34. (*
  35. **      $VER: diskfont.h 38.0 (18.6.92)
  36. **
  37. **      diskfont library definitions
  38. **
  39. **      (C) Copyright 1990 Robert R. Burns
  40. **          All Rights Reserved
  41. *)
  42.  
  43.  
  44. CONST
  45.  
  46.   maxFontPath * = 256;   (* including null terminator *)
  47.  
  48. TYPE
  49.  
  50.   FontContentsPtr * = CPOINTER TO FontContents;
  51.   FontContents * = RECORD
  52.     fileName * : ARRAY maxFontPath OF CHAR;
  53.     ySize *    : E.UWORD;
  54.     style *    : E.BSET;
  55.     flags *    : E.BSET;
  56.   END; (* FontContents *)
  57.  
  58.   TFontContentsPtr * = CPOINTER TO TFontContents;
  59.   TFontContents * = RECORD
  60.     fileName * : ARRAY maxFontPath - 2 OF CHAR;
  61.     tagCount * : E.UWORD;       (* including the tagDONE tag *)
  62.     (*
  63.      *  if tagCount is non-zero, fileName is overlayed with
  64.      *  Text Tags starting at:  SYS.VAL (U.TagItemPtr,
  65.      *    SYS.ADR (fileName[maxFontPath-(tagCount*SIZE (U.TagItem))]))
  66.      *)
  67.     ySize *    : E.UWORD;
  68.     style *    : E.BSET;
  69.     flags *    : E.BSET;
  70.   END; (* TFontContents *)
  71.  
  72.  
  73. CONST
  74.  
  75.   fchId *  = 0F00H;  (* FontContentsHeader, then FontContents *)
  76.   tfchId * = 0F02H;  (* FontContentsHeader, then TFontContents *)
  77.   ofchId * = 0F03H;  (* FontContentsHeader, then TFontContents,
  78.                       * associated with outline font *)
  79.  
  80. TYPE
  81.  
  82.   FontContentsHeaderPtr * = CPOINTER TO FontContentsHeader;
  83.   FontContentsHeader * = RECORD
  84.     fileID *     : E.UWORD; (* fchID *)
  85.     numEntries * : E.UWORD; (* the number of FontContents elements *)
  86.   (**fc *         : ARRAY numEntries OF FontContents or
  87.     tfc *        : ARRAY numEntries OF TFontContents *)
  88.   END; (* FontContentsHeader *)
  89.  
  90.  
  91. CONST
  92.  
  93.   dfhId *       = 0F80H;
  94.   maxFontName * =    32; (* font name including ".font\0" *)
  95.  
  96. TYPE
  97.  
  98.   DiskFontHeaderPtr * = CPOINTER TO DiskFontHeader;
  99.  
  100.     (* the following 8 bytes are not actually considered a part of the  *)
  101.     (* DiskFontHeader, but immediately preceed it. The nextSegment is   *)
  102.     (* supplied by the linker/loader, and the returnCode is the code    *)
  103.     (* at the beginning of the font in case someone runs it...          *)
  104.     (*   nextSegment : E.ULONG;              (* actually a BPTR *)      *)
  105.     (*   returnCode  : E.ULONG;              (* MOVEQ #0,D0 : RTS *)    *)
  106.     (* here then is the official start of the DiskFontHeader...         *)
  107.   DiskFontHeader * = RECORD (E.Node) (* node to link disk fonts *)
  108.     fileID *   : E.UWORD;            (* dfhID *)
  109.     revision * : E.UWORD;            (* the font revision *)
  110.     segment *  : SYS.BPTR;           (* the segment address when loaded *)
  111.     dfhName *  : ARRAY maxFontName OF CHAR; (* the font name (null terminated) *)
  112.     tf *       : G.TextFont;         (* loaded TextFont structure *)
  113.   END; (* DiskFontHeader *)
  114.  
  115. (* unfortunately, this needs to be explicitly typed *)
  116. (* used only if tf.tfStyle fsTagged bit is set *)
  117.  
  118. (*  DiskFontHeader.tagList = DiskFontHeader.segment; (* destroyed during loading *)*)
  119.  
  120.  
  121. CONST
  122.  
  123.   afMemory * = 0;
  124.   afDisk * =   1;
  125.   afScaled * = 2;
  126.   afBitmap * = 3;
  127.  
  128.   afTagged * = 16;      (* return TAvailFonts *)
  129.  
  130. TYPE
  131.  
  132.   AvailFontPtr * = CPOINTER TO AvailFont;
  133.   AvailFont * = RECORD
  134.     type * : E.WSET;        (* MEMORY, DISK, or SCALED *)
  135.     attr * : G.TextAttr;    (* text attributes for font *)
  136.   END; (* AvailFont *)
  137.  
  138.   TAvailFontPtr * = CPOINTER TO TAvailFont;
  139.   TAvailFont * = RECORD
  140.     Type * : E.WSET;       (* MEMORY, DISK, or SCALED *)
  141.     Attr * : G.TTextAttr;  (* text attributes for font *)
  142.   END; (* TAvailFont *)
  143.  
  144.   AvailFontsHeaderPtr * = CPOINTER TO AvailFontsHeader;
  145.   AvailFontsHeader * = RECORD
  146.     numEntries * : E.UWORD;      (* number of AvailFonts elements *)
  147.   (**af *         : ARRAY numEntries OF AvailFont or
  148.     taf *         : ARRAY numEntries OF TAvailFont*)
  149.   END; (* AvailFontsHeader *)
  150.  
  151.  
  152. (*
  153. **      $VER: diskfonttag.h 10.4 (14.7.92)
  154. **
  155. **      libraries/diskfonttag.h -- tag definitions for .otag files
  156. **
  157. **      (C) Copyright 1990-1992 Robert R. Burns
  158. **          All Rights Reserved
  159. *)
  160.  
  161. CONST
  162.  
  163. (* Level 0 entries never appear in the .otag tag list, but appear in font
  164.  * specifications *)
  165.    otLevel0 *   =   U.tagUser;
  166. (* Level 1 entries are required to exist in the .otag tag list *)
  167.    otLevel1 *   =   U.tagUser + 1000H;
  168. (* Level 2 entries are optional typeface metric tags *)
  169.    otLevel2 *   =   U.tagUser + 2000H;
  170. (* Level 3 entries are required for some otEngines *)
  171.    otLevel3 *   =   U.tagUser + 3000H;
  172. (* Indirect entries are at (tag address + data offset) *)
  173.    otIndirect * =   8000H;
  174.  
  175. (********************************************************************)
  176. (* font specification and inquiry tags *)
  177.  
  178. (* !  tags flagged with an exclaimation mark are valid for
  179.  *    specification.
  180.  *  ? tags flagged with a question mark are valid for inquiry
  181.  *
  182.  * fixed binary numbers are encoded as 16 bits of integer and
  183.  * 16 bits of fraction.  Negative values are indicated by twos
  184.  * complement of all 32 bits.
  185.  *)
  186.  
  187. (* !  otDeviceDPI specifies the target device dots per inch -- X DPI is
  188.  *    in the high word, Y DPI in the low word. *)
  189.   otDeviceDPI * = otLevel0 + 01H;                (* == taDeviceDPI *)
  190.  
  191. (* !  OT_Dot_Size specifies the target device dot size as a percent of
  192.  *    it's resolution-implied size -- X percent in high word, Y percent
  193.  *    in low word. *)
  194.   otDotSize * = otLevel0 + 02H;
  195.  
  196. (* !  OT_Point_Height specifies the requested point height of a typeface,
  197.  *    specifically, the height and nominal width of the em-square.
  198.  *    The point referred to here is 1/72".  It is encoded as a fixed
  199.  *    binary number. *)
  200.   otPointHeight * = otLevel0 + 08H;
  201.  
  202. (* !  otSetFactor specifies the requested set width of a typeface.
  203.  *    It distorts the width of the em-square from that specified by
  204.  *    otPointHeight.  To compensate for a device with different
  205.  *    horizontal and vertical resolutions, otDeviceDpi should be used
  206.  *    instead.  For a normal aspect ratio, set to 1.0 (encoded as
  207.  *    0x00010000).  This is the default value. *)
  208.   otSetFactor * = otLevel0 + 09H;
  209.  
  210. (* !  otShear... specifies the Sine and Cosine of the vertical stroke
  211.  *    angle, as two fixed point binary fractions.  Both must be specified:
  212.  *    first the Sine and then the Cosine.  Setting the sine component
  213.  *    changes the Shear to an undefined value, setting the cosine
  214.  *    component completes the Shear change to the new composite value.
  215.  *    For no shear, set to 0.0, 1.0 (encoded as 0x00000000, 0x00010000).
  216.  *    This is the default value. *)
  217.   otShearSin * = otLevel0 + 0AH;
  218.   otShearCos * = otLevel0 + 0BH;
  219.  
  220. (* !  otRotate... specifies the Sine and Cosine of the baselin rotation
  221.  *    angle, as two fixed point binary fractions.  Both must be specified:
  222.  *    first the Sine and then the Cosine.  Setting the sine component
  223.  *    changes the Shear to an undefined value, setting the cosine
  224.  *    component completes the Shear change to the new composite value.
  225.  *    For no shear, set to 0.0, 1.0 (encoded as 0x00000000, 0x00010000).
  226.  *    This is the default value. *)
  227.   otRotateSin * = otLevel0 + 0CH;
  228.   otRotateCos * = otLevel0 + 0DH;
  229.  
  230. (* !  otEmbolden... specifies values to algorithimically embolden -- or,
  231.  *    when negative, lighten -- the glyph.  It is encoded as a fixed point
  232.  *    binary fraction of the em-square.  The X and Y components can be
  233.  *    changed indendently.  For normal characters, set to 0.0, 0.0
  234.  *    (encoded as 0x00000000, 0x00000000).  This is the default value. *)
  235.   otEmboldenX * = otLevel0 + 0EH;
  236.   otEmboldenY * = otLevel0 + 0FH;
  237.  
  238. (* !  otPointSize is an old method of specifying the point size,
  239.  *    encoded as (points * 16). *)
  240.   otPointSize * = otLevel0 + 10H;
  241.  
  242. (* !  otGlyphCode specifies the glyph (character) code to use with
  243.  *    subsequent operations.  For example, this is the code for an
  244.  *    otGlyph inquiry *)
  245.   otGlyphCode * = otLevel0 + 11H;
  246.  
  247. (* !  otGlyphCode2 specifies the second glyph code.  For example,
  248.  *    this is the right glyph of the two glyphs of an otKernPair
  249.  *    inquiry *)
  250.   otGlyphCode2 * = otLevel0 + 12H;
  251.  
  252. (* !  otGlyphWidth specifies a specific width for a glyph.
  253.  *    It sets a specific escapement (advance) width for subsequent
  254.  *    glyphs.  It is encoded as a fixed binary fraction of the em-square.
  255.  *    To revert to using the font-defined escapement for each glyph, set
  256.  *    to 0.0 (encoded as 0x00000000).  This is the default value. *)
  257.   otGlyphWidth * = otLevel0 + 13H;
  258.  
  259. (* !  otOTagPath and
  260.  * !  otOTagList specify the selected typeface.  Both must be specified:
  261.  *    first the Path and then the List.  Setting the path name changes
  262.  *    changes the typeface to an undefined value, providing the List
  263.  *    completes the typeface selection to the new typeface.  OTagPath
  264.  *    is the null terminated full file path of the .otag file associated
  265.  *    with the typeface.  OTagList is a memory copy of the processed
  266.  *    contents of that .otag file (i.e. with indirections resolved).
  267.  *    There are no default values for the typeface. *)
  268.   otOTagPath * = otLevel0 + otIndirect + 14H;
  269.   otOTagList * = otLevel0 + otIndirect + 15H;
  270.  
  271. (*  ? otGlyphMap supplies a read-only struct GlyphMap pointer that
  272.  *    describes a bitmap for a glyph with the current attributes. *)
  273.   otGlyphMap * = otLevel0 + otIndirect + 20H;
  274.  
  275. (*  ? otWidthList supplies a read-only struct MinList of struct
  276.  *    GlyphWidthEntry nodes for glyphs that are defined from GlyphCode
  277.  *    to GlyphCode2, inclusive.  The widths are represented as fixed
  278.  *    binary fractions of the em-square, ignoring any effect of
  279.  *    SetFactor or GlyphWidth.  A width would need to be converted to
  280.  *    a distance along the baseline in device units by the
  281.  *    application. *)
  282.   otWidthList * = otLevel0 + otIndirect + 21H;
  283.  
  284. (*  ? ot...KernPair supplies the kern adjustment to be added to the
  285.  *    current position after placement of the GlyphCode glyph and
  286.  *    before placement of the GlyphCode2 glyph.  Text kern pairs are
  287.  *    for rendering body text.  Display kern pairs are generally
  288.  *    tighter values for display (e.g. headline) purposes.  The
  289.  *    adjustment is represented as a fixed binary fraction of the
  290.  *    em-square, ignoring any effect of SetFactor.  This number would
  291.  *    need to be converted to a distance along the baseline in device
  292.  *    units by the application. *)
  293.   otTextKernPair * = otLevel0 + otIndirect + 22H;
  294.   otDesignKernPair * = otLevel0 + otIndirect + 23H;
  295.  
  296. (*  ? otUnderlined is an unsigned word which is used to request
  297.  *    algorithimic underlining for the engine when rendering the glyph.
  298.  *    Bullet.library currently does not support this tag, though it
  299.  *    may be used by other engines in the future.  The default for
  300.  *    any engine which supports this tag must be otulNone.  Engines which
  301.  *    do not support this tag should return an appropriate otErr value.
  302.  *
  303.  *    As of V39, diskfont.library will request underlining if specified
  304.  *    in the TextAttr, or TTextAttr passed to OpenDiskFont().  Diskfont
  305.  *    will first request Broken underlining (like the Text() function
  306.  *    does when SetSoftStyle() is used), and then Solid underlining if
  307.  *    the engine returns an error.  If the engine returns an error for
  308.  *    both, then diskfont.library attempts to find, or create the best
  309.  *    non-underlined font that it can. *)
  310.   otUnderLined * = otLevel0 + 24H;
  311.  
  312.   otulNone * = 0;
  313.   otulSolid * = 1;
  314.   otulBroken * = 2;
  315.   otulDoubleSolid * = 3;
  316.   outlDoubleBroken * = 4;
  317.  
  318. (*  ? otStrikeThrough is a boolean which is used to request
  319.  *    algorithimic strike through when rendering the glyph.
  320.  *    Bullet.library currently does not support this tag, though it
  321.  *    may be used by other engines in the future.  The default for
  322.  *    any engined which supports this tag must be FALSE.  Engines which
  323.  *    do not support this tag should return an appropriate otErr value. *)
  324.   otStrikeThrough * = otLevel0 + 25H;
  325.  
  326. (********************************************************************)
  327. (* .otag tags *)
  328.  
  329. (* suffix for files in FONTS: that contain these tags *)
  330.    otSuffix * =      ".otag";
  331.  
  332. (* otFileIdent both identifies this file and verifies its size.
  333.  * It is required to be the first tag in the file. *)
  334.    otFileIdent * =   otLevel1 + 01H;
  335.  
  336. (* otEngine specifies the font engine this file is designed to use *)
  337.    otEngine * =      otLevel1 + otIndirect + 02H;
  338.    oteBullet * =     "bullet";
  339.  
  340. (* otFamily is the family name of this typeface *)
  341.    otFamily * =      otLevel1 + otIndirect + 03H;
  342.  
  343. (* The name of this typeface is implicit in the name of the .otag file *)
  344. (* otBName is used to find the bold variant of this typeface *)
  345.    otBName * =       otLevel2 + otIndirect + 05H;
  346. (* otIName is used to find the italic variant of this typeface *)
  347.    otIName * =       otLevel2 + otIndirect + 06H;
  348. (* otBIName is used to find the bold italic variant of this typeface *)
  349.    otBIName * =      otLevel2 + otIndirect + 07H;
  350.  
  351. (* otSymSet is used to select the symbol set that has the otYSizeFactor
  352.  * described here.  Other symbol sets might have different extremes *)
  353.    otSymbolSet * =   otLevel1 + 10H;
  354.  
  355. (* otYSizeFactor is a ratio to assist in calculating the Point height
  356.  * to BlackHeight relationship -- high word: Point height term, low
  357.  * word: Black height term -- pointSize * = ysize*<high>/<low> *)
  358.    otYSizeFactor * = otLevel1 + 11H;
  359.  
  360. (* otSpaceWidth specifies the width of the space character relative
  361.  * to the character height *)
  362.    otSpaceWidth * =  otLevel2 + 12H;
  363.  
  364. (* otIsFixed is a boolean indicating that all the characters in the
  365.  * typeface are intended to have the same character advance *)
  366.    otIsFixed * =     otLevel2 + 13H;
  367.  
  368. (* otSerifFlag is a boolean indicating if the character has serifs *)
  369.    otSerifFlag * =   otLevel1 + 14H;
  370.  
  371. (* otStemWeight is an unsigned byte indicating the weight of the character *)
  372.    otStemWeight * =  otLevel1 + 15H;
  373.  
  374.    otsUltraThin *  =   8;     (*   0- 15 *)
  375.    otsExtraThin *  =  24;     (*  16- 31 *)
  376.    otsThin *       =  40;     (*  32- 47 *)
  377.    otsExtraLight * =  56;     (*  48- 63 *)
  378.    otsLight *      =  72;     (*  64- 79 *)
  379.    otsDemiLight *  =  88;     (*  80- 95 *)
  380.    otsSemiLight *  = 104;     (*  96-111 *)
  381.    otsBook *       = 120;     (* 112-127 *)
  382.    otsMedium *     = 136;     (* 128-143 *)
  383.    otsSemiBold *   = 152;     (* 144-159 *)
  384.    otsDemiBold *   = 168;     (* 160-175 *)
  385.    otsBold *       = 184;     (* 176-191 *)
  386.    otsExtraBold *  = 200;     (* 192-207 *)
  387.    otsBlack *      = 216;     (* 208-223 *)
  388.    otsExtraBlack * = 232;     (* 224-239 *)
  389.    otsUltraBlack * = 248;     (* 240-255 *)
  390.  
  391. (* otSlantStyle is an unsigned byte indicating the font posture *)
  392.    otSlantStyle * = otLevel1 + 16H;
  393.    otsUpright *    = 0;
  394.    otsItalic *     = 1;       (* Oblique, Slanted, etc. *)
  395.    otsLeftItalic * = 2;       (* Reverse Slant *)
  396.  
  397. (* otHorizStyle is an unsigned byte indicating the appearance width *)
  398.    otHorizStyle *       = otLevel1 + 17H;
  399.    othUltraCompressed * =  16;     (*   0- 31 *)
  400.    othExtraCompressed * =  48;     (*  32- 63 *)
  401.    othCompressed *      =  80;     (*  64- 95 *)
  402.    othCondensed *       = 112;     (*  96-127 *)
  403.    othNormal *          = 144;     (* 128-159 *)
  404.    othSemiExpanded *    = 176;     (* 160-191 *)
  405.    othExpanded *        = 208;     (* 192-223 *)
  406.    othExtraExpanded *   = 240;     (* 224-255 *)
  407.  
  408. (* otSpaceFactor specifies the width of the space character relative
  409.  * to the character height *)
  410.    otSpaceFactor * = otLevel2 + 18H;
  411.  
  412. (* otInhibitAlgoStyle indicates which style bits, if any, should
  413.  * be ignored even if the font does not already have that quality.
  414.  * For example, if fsBold is set and the typeface is not bold but
  415.  * the user specifies bold, the application or diskfont library is
  416.  * not to use otEmbolden to achieve a bold result. *)
  417.    otInhibitAlgoStyle * = otLevel2 + 19H;
  418.  
  419. (* otAvailSizes is an indirect pointer to sorted UWORDs, 0th is count *)
  420.    otAvailSizes * = otLevel1 + otIndirect + 20H;
  421.    otMaxAvailSizes * =      20;      (* no more than 20 sizes allowed *)
  422.  
  423. (* otSpecCount is the count number of parameters specified here *)
  424.    otSpecCount * =  otLevel1 + 100H;
  425.  
  426. (* otSpecs can be created as appropriate for the engine by ORing in the
  427.  * parameter number (1 is first, 2 is second, ... up to 15th) *)
  428.    otSpec * =       otLevel1 + 100H;
  429. (* otSpec1 is the (first) parameter to the font engine to select
  430.  * this particular typeface *)
  431.    otSpec1 * =      otLevel1 + 101H;
  432.  
  433. (*
  434. **      $VER: glyph.h 9.1 (19.6.92)
  435. **
  436. **      glyph.h -- structures for glyph libraries
  437. **
  438. **      (C) Copyright 1991-1992 Robert R. Burns
  439. **          All Rights Reserved
  440. *)
  441.  
  442. TYPE
  443.  
  444. (* A GlyphEngine must be acquired via OpenEngine and is read-only *)
  445.   GlyphEnginePtr * = CPOINTER TO GlyphEngine;
  446.   GlyphEngine  * = RECORD
  447.     library * : E.LibraryPtr;   (* engine library *)
  448.     name *    : E.STRPTR;       (* library basename: e.g. "bullet" *)
  449.     (* private library data follows... *)
  450.   END;
  451.  
  452.   FIXED * = LONGINT;            (* 32 bit signed w/ 16 bits of fraction *)
  453.  
  454.   GlyphMapPtr * = CPOINTER TO GlyphMap;
  455.   GlyphMap  * = RECORD
  456.     bmModulo *     : E.UWORD;  (* # of bytes in row: always multiple of 4 *)
  457.     bmRows *       : E.UWORD;  (* # of rows in bitmap *)
  458.     blackLeft *    : E.UWORD;  (* # of blank pixel columns at left *)
  459.     blackTop *     : E.UWORD;  (* # of blank rows at top *)
  460.     blackWidth *   : E.UWORD;  (* span of contiguous non-blank columns *)
  461.     blackHeight *  : E.UWORD;  (* span of contiguous non-blank rows *)
  462.     xOrigin *      : FIXED;    (* distance from upper left corner of bitmap *)
  463.     yOrigin *      : FIXED;    (*   to initial CP, in fractional pixels *)
  464.     x0 *           : INTEGER;  (* approximation of XOrigin in whole pixels *)
  465.     y0 *           : INTEGER;  (* approximation of YOrigin in whole pixels *)
  466.     x1 *           : INTEGER;  (* approximation of XOrigin + Width *)
  467.     y1 *           : INTEGER;  (* approximation of YOrigin + Width *)
  468.     width *        : FIXED;    (* character advance, as fraction of em width *)
  469.     bitMap *       : E.APTR;   (* actual glyph bitmap *)
  470.   END;
  471.  
  472.   GlyphWidthEntryPtr * = CPOINTER TO GlyphWidthEntry;
  473.   GlyphWidthEntry  * = RECORD (E.MinNode)
  474.                         (* on list returned by otWidthList inquiry *)
  475.     code *  : E.UWORD;  (* entry's character code value *)
  476.     width * : FIXED;    (* character advance, as fraction of em width *)
  477.   END;
  478.  
  479. (*
  480. **      $VER: oterrors.h 8.1 (19.6.92)
  481. **
  482. **      oterrors.h -- error results from outline libraries
  483. **
  484. **      (C) Copyright 1991-1992 Robert R. Burns
  485. **          All Rights Reserved
  486. *)
  487.  
  488. CONST
  489.  
  490. (* PRELIMINARY *)
  491.   otErrFailure *      = -1;  (* catch-all for error *)
  492.   otErrSuccess *      = 0;   (* no error *)
  493.   otErrBadTag *       = 1;   (* inappropriate tag for function *)
  494.   otErrUnknownTag *   = 2;   (* unknown tag for function *)
  495.   otErrBadData *      = 3;   (* catch-all for bad tag data *)
  496.   otErrNoMemory *     = 4;   (* insufficient memory for operation *)
  497.   otErrNoFace *       = 5;   (* no typeface currently specified *)
  498.   otErrBadFace *      = 6;   (* typeface specification problem *)
  499.   otErrNoGlyph *      = 7;   (* no glyph specified *)
  500.   otErrBadGlyph *     = 8;   (* bad glyph code or glyph range *)
  501.   otErrNoShear *      = 9;   (* shear only partially specified *)
  502.   otErrNoRotate *     = 10;  (* rotate only partially specified *)
  503.   otErrTooSmall *     = 11;  (* typeface metrics yield tiny glyphs *)
  504.   otErrUnknownGlyph * = 12;  (* glyph not known by engine *)
  505.  
  506.  
  507. (**-- Library Base variable --------------------------------------------*)
  508.  
  509. TYPE
  510.  
  511.   DiskFontBasePtr * = CPOINTER TO DiskFontBase;
  512.   DiskFontBase * = RECORD (E.Library) END;
  513.  
  514. CONST
  515.  
  516.   name * = "diskfont.library";
  517.  
  518. VAR
  519.  
  520.   base *  : DiskFontBasePtr;
  521.  
  522.  
  523. (**-- Library Functions ------------------------------------------------*)
  524.  
  525. (*
  526. **      $VER: diskfont_protos.h 38.0 (18.6.92)
  527. *)
  528.  
  529. LIBCALL (base : DiskFontBasePtr) OpenDiskFont*
  530.   ( VAR textAttr [8] : G.TextAttr )
  531.   : G.TextFontPtr;
  532.   -30;
  533. LIBCALL (base : DiskFontBasePtr) AvailFonts*
  534.   ( VAR buffer [8] : ARRAY OF SYS.BYTE;
  535.     bufBytes   [0] : LONGINT;
  536.     flags      [1] : SET )
  537.   : LONGINT;
  538.   -36;
  539.  
  540. (* --- functions in V34 or higher (distributed as Release 1.3) ---*)
  541.  
  542. LIBCALL (base : DiskFontBasePtr) NewFontContents*
  543.   ( fontsLock [8] : D.FileLockPtr;
  544.     fontName  [9] : ARRAY OF CHAR )
  545.   : FontContentsHeaderPtr;
  546.   -42;
  547. LIBCALL (base : DiskFontBasePtr) DisposeFontContents*
  548.   ( fontContentsHeader [9] : FontContentsHeaderPtr );
  549.   -48;
  550.  
  551. (* --- functions in V36 or higher (distributed as Release 2.0) ---*)
  552.  
  553. LIBCALL (base : DiskFontBasePtr) NewScaledDiskFont*
  554.   ( sourceFont       [8] : G.TextFontPtr;
  555.     VAR destTextAttr [9] : G.TextAttr )
  556.   : DiskFontHeaderPtr;
  557.   -54;
  558.  
  559. (**-- Library Base variable --------------------------------------------*)
  560. (** $L- Address globals through A4 *)
  561.  
  562.  
  563. (**-----------------------------------*)
  564. PROCEDURE* CloseLib ();
  565.  
  566. BEGIN (* CloseLib *)
  567.   IF base # NIL THEN E.base.CloseLibrary (base) END;
  568. END CloseLib;
  569.  
  570. (**-----------------------------------*)
  571. PROCEDURE OpenLib * (mustOpen : BOOLEAN);
  572.  
  573. BEGIN (* OpenLib *)
  574.   IF base = NIL THEN
  575.     base :=
  576.       SYS.VAL
  577.         ( DiskFontBasePtr,
  578.           E.base.OpenLibrary (name, E.libraryMinimum));
  579.     IF base # NIL THEN SYS.SETCLEANUP (CloseLib)
  580.     ELSIF mustOpen THEN HALT (100)
  581.     END;
  582.   END;
  583. END OpenLib;
  584.  
  585.  
  586. BEGIN
  587.   base := NIL
  588. END DiskFont.
  589.